//
// CPSUtil.java
// Copyright (C) 2010  "Naush" <naush _ hotmail _ fr>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>./* ----------------------------------------------------------------------------







package org.ryzom.nel.threed;

import org.ryzom.nel.misc.CRGBA;
import org.ryzom.nel.misc.CVector;

public class CPSUtil {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public CPSUtil(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(CPSUtil obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nel3dJNI.delete_CPSUtil(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public static void registerSerialParticleSystem() {
    nel3dJNI.CPSUtil_registerSerialParticleSystem();
  }

  public static void displayBBox(IDriver driver, SWIGTYPE_p_NLMISC__CAABBox box, CRGBA col) {
    nel3dJNI.CPSUtil_displayBBox__SWIG_0(IDriver.getCPtr(driver), driver, SWIGTYPE_p_NLMISC__CAABBox.getCPtr(box), CRGBA.getCPtr(col), col);
  }

  public static void displayBBox(IDriver driver, SWIGTYPE_p_NLMISC__CAABBox box) {
    nel3dJNI.CPSUtil_displayBBox__SWIG_1(IDriver.getCPtr(driver), driver, SWIGTYPE_p_NLMISC__CAABBox.getCPtr(box));
  }

  public static void displaySphere(IDriver driver, float radius, CVector center, long nbSubdiv, CRGBA color) {
    nel3dJNI.CPSUtil_displaySphere__SWIG_0(IDriver.getCPtr(driver), driver, radius, CVector.getCPtr(center), center, nbSubdiv, CRGBA.getCPtr(color), color);
  }

  public static void displaySphere(IDriver driver, float radius, CVector center, long nbSubdiv) {
    nel3dJNI.CPSUtil_displaySphere__SWIG_1(IDriver.getCPtr(driver), driver, radius, CVector.getCPtr(center), center, nbSubdiv);
  }

  public static void displaySphere(IDriver driver, float radius, CVector center) {
    nel3dJNI.CPSUtil_displaySphere__SWIG_2(IDriver.getCPtr(driver), driver, radius, CVector.getCPtr(center), center);
  }

  public static void displayDisc(IDriver driver, float radius, CVector center, SWIGTYPE_p_NLMISC__CMatrix mat, long nbSubdiv, CRGBA color) {
    nel3dJNI.CPSUtil_displayDisc__SWIG_0(IDriver.getCPtr(driver), driver, radius, CVector.getCPtr(center), center, SWIGTYPE_p_NLMISC__CMatrix.getCPtr(mat), nbSubdiv, CRGBA.getCPtr(color), color);
  }

  public static void displayDisc(IDriver driver, float radius, CVector center, SWIGTYPE_p_NLMISC__CMatrix mat, long nbSubdiv) {
    nel3dJNI.CPSUtil_displayDisc__SWIG_1(IDriver.getCPtr(driver), driver, radius, CVector.getCPtr(center), center, SWIGTYPE_p_NLMISC__CMatrix.getCPtr(mat), nbSubdiv);
  }

  public static void displayDisc(IDriver driver, float radius, CVector center, SWIGTYPE_p_NLMISC__CMatrix mat) {
    nel3dJNI.CPSUtil_displayDisc__SWIG_2(IDriver.getCPtr(driver), driver, radius, CVector.getCPtr(center), center, SWIGTYPE_p_NLMISC__CMatrix.getCPtr(mat));
  }

  public static void displayCylinder(IDriver driver, CVector center, SWIGTYPE_p_NLMISC__CMatrix mat, CVector dim, long nbSubdiv, CRGBA color) {
    nel3dJNI.CPSUtil_displayCylinder__SWIG_0(IDriver.getCPtr(driver), driver, CVector.getCPtr(center), center, SWIGTYPE_p_NLMISC__CMatrix.getCPtr(mat), CVector.getCPtr(dim), dim, nbSubdiv, CRGBA.getCPtr(color), color);
  }

  public static void displayCylinder(IDriver driver, CVector center, SWIGTYPE_p_NLMISC__CMatrix mat, CVector dim, long nbSubdiv) {
    nel3dJNI.CPSUtil_displayCylinder__SWIG_1(IDriver.getCPtr(driver), driver, CVector.getCPtr(center), center, SWIGTYPE_p_NLMISC__CMatrix.getCPtr(mat), CVector.getCPtr(dim), dim, nbSubdiv);
  }

  public static void displayCylinder(IDriver driver, CVector center, SWIGTYPE_p_NLMISC__CMatrix mat, CVector dim) {
    nel3dJNI.CPSUtil_displayCylinder__SWIG_2(IDriver.getCPtr(driver), driver, CVector.getCPtr(center), center, SWIGTYPE_p_NLMISC__CMatrix.getCPtr(mat), CVector.getCPtr(dim), dim);
  }

  public static void display3DQuad(IDriver driver, CVector c1, CVector c2, CVector c3, CVector c4, CRGBA color) {
    nel3dJNI.CPSUtil_display3DQuad__SWIG_0(IDriver.getCPtr(driver), driver, CVector.getCPtr(c1), c1, CVector.getCPtr(c2), c2, CVector.getCPtr(c3), c3, CVector.getCPtr(c4), c4, CRGBA.getCPtr(color), color);
  }

  public static void display3DQuad(IDriver driver, CVector c1, CVector c2, CVector c3, CVector c4) {
    nel3dJNI.CPSUtil_display3DQuad__SWIG_1(IDriver.getCPtr(driver), driver, CVector.getCPtr(c1), c1, CVector.getCPtr(c2), c2, CVector.getCPtr(c3), c3, CVector.getCPtr(c4), c4);
  }

  public static void addRadiusToAABBox(SWIGTYPE_p_NLMISC__CAABBox box, float radius) {
    nel3dJNI.CPSUtil_addRadiusToAABBox(SWIGTYPE_p_NLMISC__CAABBox.getCPtr(box), radius);
  }

  public static void displayBasis(IDriver driver, SWIGTYPE_p_NLMISC__CMatrix modelMat, SWIGTYPE_p_NLMISC__CMatrix m, float size, CFontGenerator fg, CFontManager fm) {
    nel3dJNI.CPSUtil_displayBasis(IDriver.getCPtr(driver), driver, SWIGTYPE_p_NLMISC__CMatrix.getCPtr(modelMat), SWIGTYPE_p_NLMISC__CMatrix.getCPtr(m), size, CFontGenerator.getCPtr(fg), fg, CFontManager.getCPtr(fm), fm);
  }

  public static void displayArrow(IDriver driver, CVector start, CVector v, float size, CRGBA col1, CRGBA col2) {
    nel3dJNI.CPSUtil_displayArrow(IDriver.getCPtr(driver), driver, CVector.getCPtr(start), start, CVector.getCPtr(v), v, size, CRGBA.getCPtr(col1), col1, CRGBA.getCPtr(col2), col2);
  }

  public static void print(IDriver driver, String text, CFontGenerator fg, CFontManager fm, CVector pos, float size, CRGBA col) {
    nel3dJNI.CPSUtil_print__SWIG_0(IDriver.getCPtr(driver), driver, text, CFontGenerator.getCPtr(fg), fg, CFontManager.getCPtr(fm), fm, CVector.getCPtr(pos), pos, size, CRGBA.getCPtr(col), col);
  }

  public static void print(IDriver driver, String text, CFontGenerator fg, CFontManager fm, CVector pos, float size) {
    nel3dJNI.CPSUtil_print__SWIG_1(IDriver.getCPtr(driver), driver, text, CFontGenerator.getCPtr(fg), fg, CFontManager.getCPtr(fm), fm, CVector.getCPtr(pos), pos, size);
  }

  public static void buildSchmidtBasis(CVector v, SWIGTYPE_p_NLMISC__CMatrix dest) {
    nel3dJNI.CPSUtil_buildSchmidtBasis(CVector.getCPtr(v), v, SWIGTYPE_p_NLMISC__CMatrix.getCPtr(dest));
  }

  public static float getCos(int angle) {
    return nel3dJNI.CPSUtil_getCos(angle);
  }

  public static float getSin(int angle) {
    return nel3dJNI.CPSUtil_getSin(angle);
  }

  public static void initFastCosNSinTable() {
    nel3dJNI.CPSUtil_initFastCosNSinTable();
  }

  public static float buildPerlinNoise(CVector pos, long nbOctaves) {
    return nel3dJNI.CPSUtil_buildPerlinNoise(CVector.getCPtr(pos), pos, nbOctaves);
  }

  public static void initPerlinNoiseTable() {
    nel3dJNI.CPSUtil_initPerlinNoiseTable();
  }

  public CPSUtil() {
    this(nel3dJNI.new_CPSUtil(), true);
  }

}
